Indexed Freeモナド
Freeモナドの添字付き
IxFunctorと組み合わせて、Indexedモナドを作る
データ型
code:hs
data IxFree f i j x where
Pure a :: a -> IxFree i i a
Join :: f i j (IxFree f j k a) -> IxFree f i k a
定義
code:hs
instance IxFunctor f => IxMonad (IxFree f) where
ireturn = Pure
ibind k (Pure a) = k a
ibind k (Free f) = Free $ imap (ibind k) f
https://hackage.haskell.org/package/indexed-free-0.2
https://blog.poisson.chat/posts/2019-06-09-free-monads-free-monads.html
https://personal.cis.strath.ac.uk/conor.mcbride/Kleisli.pdf
https://ocharles.org.uk/posts/2013-11-24-using-indexed-free-monads-to-quickcheck-json.html
https://hackage.haskell.org/package/indexed-free
https://stackoverflow.com/questions/27676294/working-out-the-details-of-a-type-indexed-free-monad